cmake_minimum_required(VERSION 3.10)

project(canon)

# 第三方库头文件路径
set(BOOST_INCLUDE_DIR /opt/homebrew/Cellar/boost/1.84.0_1/include)
set(YAML_INCLUDE_DIR /usr/local/include)

set(BUILD_OUTPUT_DIR ${ROOT_PATH}/build/canon)
set(LIB_OUTPUT_DIR ${ROOT_PATH}/lib)

# 第三方库库文件路径
set(YAML_LIB_DIR /usr/local/lib/)

find_package(yaml-cpp REQUIRED)

add_library(${PROJECT_NAME} SHARED
        config.cpp
        env.cpp
        log.cpp
        util/utils.cpp
)

include_directories(
        ${BOOST_INCLUDE_DIR}
        ${YAML_INCLUDE_DIR}
)

link_directories(
        #${YAML_LIB_DIR}
)

target_link_libraries(${PROJECT_NAME} PRIVATE
        yaml-cpp
)

SET(EXECUTABLE_OUTPUT_PATH ${ROOT_PATH}/bin)
SET(${CMAKE_CURRENT_LIST_DIR}/config/* ${ROOT_PATH}/bin/config)

message("LIB_OUTPUT_DIR: ${LIB_OUTPUT_DIR}")
# add_custom_target(TARGET {PROJECT_NAME} POST_BUILD
#         COMMAND cp ${BUILD_OUTPUT_DIR}/libcanon.dylib ${LIB_OUTPUT_DIR}
# ) 

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
        COMMAND cp -r ${ROOT_PATH}/build/canon/libcanon* ${ROOT_PATH}/lib
)
